<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['namespace' => 'Admin' , 'prefix' => 'admin' ] , function(){
    Route::group(['middleware' => 'AdminAuth'] , function (){

        Route::get('index' , 'IndexController@index');
        Route::get('test' , 'TestController@test');

        //轮播图管理
        Route::group(['prefix' => 'banner'] , function (){
            Route::get('/', 'BannerController@index');
            Route::get('/add', 'BannerController@add');
            Route::post('/add', 'BannerController@doAdd');
            Route::get('/edit/{id}', 'BannerController@edit');
            Route::post('/edit', 'BannerController@doedit');
            Route::get('/delete/{id}', 'BannerController@delete');
        });

        //装修案例管理
        Route::group(['prefix' => 'examples'] , function (){
            Route::get('/', 'ExamplesController@index');
            Route::get('/add', 'ExamplesController@add');
            Route::post('/add', 'ExamplesController@doAdd');
            Route::get('/getdata/{id}', 'ExamplesController@getdata');
            Route::get('/edit/{id}', 'ExamplesController@edit');
            Route::post('/edit', 'ExamplesController@doedit');
            Route::get('/delete/{id}', 'ExamplesController@delete');
            Route::get('/img/{id}', 'ExamplesController@example_img');
         // 案例图集管理
            Route::get('/addimg/{id}', 'ExamplesController@addimg');
            Route::post('/addimg', 'ExamplesController@doAddimg');
            Route::get('/deleteimg/{id}', 'ExamplesController@deleteimg');
        });

        //新闻中心管理
        Route::group(['prefix' => 'news'] , function (){
            Route::get('/', 'NewsController@index');
            Route::get('/add', 'NewsController@add');
            Route::post('/add', 'NewsController@doAdd');
            Route::get('/getdata/{id}', 'NewsController@getdata');
            Route::get('/edit/{id}', 'NewsController@edit');
            Route::post('/edit', 'NewsController@doedit');
            Route::get('/delete/{id}', 'NewsController@delete');

            Route::post('/update/addarticle', 'NewsController@addarticle');//新闻内容编辑
            Route::get('/addarticle/{id}', 'NewsController@article');

        });

        //房型数据管理
        Route::group(['prefix' => 'messageuser'] , function (){
            Route::get('/', 'MessageuserController@index');
            Route::get('/add', 'MessageuserController@add');
            Route::post('/add', 'MessageuserController@doAdd');
            Route::get('/edit/{id}', 'MessageuserController@edit');
            Route::post('/edit', 'MessageuserController@doedit');
            Route::get('/delete/{id}', 'MessageuserController@delete');
        });

        //贷款申请管理
        Route::group(['prefix' => 'loanapply'] , function (){
            Route::get('/', 'LoanapplyController@index');
            Route::get('/add', 'LoanapplyController@add');
            Route::post('/add', 'LoanapplyController@doAdd');
            Route::get('/edit/{id}', 'LoanapplyController@edit');
            Route::post('/edit', 'LoanapplyController@doedit');
            Route::get('/delete/{id}', 'LoanapplyController@delete');
        });

        //个人中心管理
        Route::group(['prefix' => 'personInfo'] , function (){
            Route::get('/', 'PersonInfoController@index');
            Route::get('/add', 'PersonInfoController@add');
            Route::post('/add', 'PersonInfoController@doAdd');
            Route::get('/edit/{id}', 'PersonInfoController@edit');
            Route::post('/edit', 'PersonInfoController@doedit');
            Route::get('/delete/{id}', 'PersonInfoController@delete');
            //返现管理
            Route::get('/point', 'PersonInfoController@getpoint');
            Route::post('/editpoint', 'PersonInfoController@editcash');
        });

        //合伙人市场管理
        Route::group(['prefix' => 'partner'] , function (){
            Route::get('/', 'PartnerController@index');
            Route::get('/add', 'PartnerController@add');
            Route::post('/add', 'PartnerController@doAdd');
            Route::get('/edit/{id}', 'PartnerController@edit');
            Route::post('/edit', 'PartnerController@doedit');
            Route::get('/delete/{id}', 'PartnerController@delete');
        });

        //vip用户管理
        Route::group(['prefix' => 'vipuser'] , function (){
            Route::get('/', 'VipuserController@index');

            Route::post('/edit', 'VipuserController@doedit');
            Route::get('/delete/{id}', 'VipuserController@delete');
          // 第二市场管理
            Route::get('twolist', 'VipuserController@viptwolist');
            Route::get('/twoedit/{id}', 'VipuserController@twoedit');
            Route::post('/twoedit', 'VipuserController@twodoedit');
            Route::get('/twodelete/{id}', 'VipuserController@twodelete');

        });

        Route::get('index' , 'IndexController@index');




        //权限节点start
        Route::get('/permission' , 'AdminPermissionController@getList');
        Route::get('/permission/info/{id}' , 'AdminPermissionController@getInfo');
        Route::post('/permission/update' , 'AdminPermissionController@update');
        Route::get('/permission/delete/{id}' , 'AdminPermissionController@delete');
        Route::get('/permission/add' , 'AdminPermissionController@add');
        Route::post('/permission/add' , 'AdminPermissionController@doAdd');
        //权限节点end

        //角色start
        Route::get('/roles' , 'AdminRoleController@getRoleList');
        Route::get('/roles/permission/{id}' , 'AdminRoleController@getRolePermission');
        Route::post('/roles/update' , 'AdminRoleController@updateRole');
        Route::get('/role/add' , 'AdminRoleController@addRole');
        Route::post('/role/add' , 'AdminRoleController@doAddRole');

        Route::get('/roles/del/{id}' , 'AdminRoleController@delRole');
        //角色end

        //账号start
        Route::get('/adminuser' , 'AdminUserController@getList');
        Route::get('/adminuser/info/{id}' , 'AdminUserController@getInfo');
        Route::get('/adminuser/add' , 'AdminUserController@add');
        Route::post('/adminuser/add' , 'AdminUserController@doAdd');
        Route::post('/adminuser/update' , 'AdminUserController@update');
        Route::post('/adminuser/update/permission' , 'AdminUserController@updatePermission');

        Route::get('/adminuser/permission/{id}' , 'AdminUserController@getPermission');
        //账号end

        Route::get('/current/user' , 'AdminUserController@currentLoginUser');
    });

    Route::post('upload/img/{owner}' , 'UploadController@uploadImg');

    Route::get('error' , 'ErrorController@error');
    Route::get('login' , 'AdminUserController@login');
    Route::post('login' , 'AdminUserController@doLogin');
});